﻿using DaHuaMes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DahuaMes
{
    public partial class upImage : Form
    {
        public upImage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            PicturesClass pictures = new PicturesClass();

            //SN码  00000008021080-BB016GW6AV0006
            pictures.sn=box1.Text;

            //相同sn编码图片序号   str.Substring(str.Length - 4)
            string str = box2.Text;
            pictures.seq =Convert.ToInt32(str.Substring(str.Length - 4));

            // 图片转 base64
            string path = @"D:/1.bmp";
            string base64Str = MesFun.ImageToBase64(path);
            pictures.picData = base64Str;

            //图片名称（包含文件后缀）  1.bmp
            pictures.picName = box4.Text;

            //图片生成时间（格式：yyyy - MM - dd HH: mm: ss）  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            pictures.picDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            //工序编码  如：ST01
            pictures.wpCode= box6.Text;

            //结果判定（合格 / 不合格）

            pictures.judge = "合格";

            //来源系统 （整机AA）
            pictures.source = "固化";


            string msg = "";
            MesFun.Instance.Fun_图片上传(pictures,ref msg);
            MessageBox.Show(msg);
        }


        private void box3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
